home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 July & August / PCWorld_2006-07-08_cd.bin / multimedia / dvdlabstudio / DVDlabStudio125.exe / {app} / Extras / Script / Flip Horizontal.talk < prev    next >
Text File  |  2004-03-22  |  1KB  |  53 lines

  1. /*    Horizontal Flip 1.0
  2.     by Oscar, 12 Dec 2003
  3.     
  4.     this example simply flips a bitmap or object
  5.     
  6.     To run this: DROP the Script from Assets to the Object in Menu.
  7.     
  8.     Note: because of the bitmap merging, the text will become not-editable after you apply this
  9. */
  10.  
  11. // Get the current menu and selected object when you drag and drop script
  12. // Note: if testing from Script editor make sure you have just one menu opened on desktop,
  13. //       in such case the MenuGetCurSel will return currently opened menu 
  14. menu = MenuGetCurSel() 
  15. // VTS menu 1..255, VMG menu 10001..10255 
  16.  
  17. // show the current menu on top of all others
  18. MenuActivate(menu)
  19.  
  20. object= ObjectGetCurSel(menu) 
  21.  
  22. if (object==0) then
  23.     print "No object Selected"
  24.     end
  25. endif
  26.  
  27.     
  28.     
  29. //get the image buffer from object and store it in buffer 1
  30. ImgGrabObject(1,menu,object) // imgNum = temporary image buffer 1,2 or 3
  31.  
  32. imgW = ImgGetWidth(1) 
  33. imgH = ImgGetHeight(1)
  34.  
  35. // create the target, same size
  36. ImgCreate(2,imgW,imgH)
  37.  
  38. // trace is same as print, but it will appear only in the Output window in editor
  39. trace "W =",imgW, " H=",imgH
  40.  
  41. // this is interpreter so it is slow!
  42. // show some progress or else people will see nothing happening for while
  43. ProgressBar(0,imgW,"Flipping!")
  44.  
  45.  
  46. for x=1 to imgW
  47.     ProgressSetPos(x)
  48.     ImgCopyCol(1,x,2,imgW-x+1)
  49. next x
  50.  
  51. // now put the img buffer 2 into the object!
  52. ImgSetToObject(2,menu,object)